using System;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Collections.Generic;
using System.Reflection;

namespace Xdt.Fnb.Data
{
  /// <summary>
  /// ReportsDetailedFolders Data Object Class
  /// </summary>
  public partial class DOReportsDetailedFolders
  {
    #region Class Constant declarations
    		/// <summary>
		/// The Table Column for the ReportsDetailedFolders FILENO
		/// </summary>
		public const string RowFILENO = "FILENO";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders d_folder
		/// </summary>
		public const string Rowd_folder = "d_folder";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders d_loc
		/// </summary>
		public const string Rowd_loc = "d_loc";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders d_user
		/// </summary>
		public const string Rowd_user = "d_user";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders doctype
		/// </summary>
		public const string Rowdoctype = "doctype";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders d_status
		/// </summary>
		public const string Rowd_status = "d_status";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders d_datetime
		/// </summary>
		public const string Rowd_datetime = "d_datetime";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders LOCNO
		/// </summary>
		public const string RowLOCNO = "LOCNO";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders FSTATUS
		/// </summary>
		public const string RowFSTATUS = "FSTATUS";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders barcode
		/// </summary>
		public const string Rowbarcode = "barcode";

		/// <summary>
		/// The Table Column for the ReportsDetailedFolders d_accno
		/// </summary>
		public const string Rowd_accno = "d_accno";


#region Stored Procedures
private const string m_StoredProcedureConstRetrieve = "spReportsDetailedFolders_Retrieve";
private const string m_StoredProcedureConstRetrieveall = "spReportsDetailedFolders_Retrieveall";
#endregion
    
    
    #endregion

    #region Class Variable declarations
    	#region DO Variables
		private string m_FILENO;
		private string m_d_folder;
		private string m_d_loc;
		private string m_d_user;
		private string m_doctype;
		private string m_d_status;
		private DateTime m_d_datetime;
		private string m_LOCNO;
		private string m_FSTATUS;
		private string m_barcode;
		private string m_d_accno;
	#endregion
    
	#region Default Variables
	private SQLDataObject sqlData;
	private List<DOReportsDetailedFolders> m_ReportsDetailedFolderss = new List<DOReportsDetailedFolders>();
	#endregion
	
    #endregion

    #region Class Constructors & Destructors
    /// <summary>
    /// Class Constructor
    /// </summary>
    public DOReportsDetailedFolders() { }
    #endregion

    #region Class Properties
    #region DO Properties
		/// <summary>
		/// FILENO
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders FILENO
		/// </remarks>
		public string FILENO
		{
			get { return (this.m_FILENO); }
			set { this.m_FILENO = value; }
		}

		/// <summary>
		/// d_folder
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders d_folder
		/// </remarks>
		public string d_folder
		{
			get { return (this.m_d_folder); }
			set { this.m_d_folder = value; }
		}

		/// <summary>
		/// d_loc
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders d_loc
		/// </remarks>
		public string d_loc
		{
			get { return (this.m_d_loc); }
			set { this.m_d_loc = value; }
		}

		/// <summary>
		/// d_user
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders d_user
		/// </remarks>
		public string d_user
		{
			get { return (this.m_d_user); }
			set { this.m_d_user = value; }
		}

		/// <summary>
		/// doctype
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders doctype
		/// </remarks>
		public string doctype
		{
			get { return (this.m_doctype); }
			set { this.m_doctype = value; }
		}

		/// <summary>
		/// d_status
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders d_status
		/// </remarks>
		public string d_status
		{
			get { return (this.m_d_status); }
			set { this.m_d_status = value; }
		}

		/// <summary>
		/// d_datetime
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders d_datetime
		/// </remarks>
		public DateTime d_datetime
		{
			get { return (this.m_d_datetime); }
			set { this.m_d_datetime = value; }
		}

		/// <summary>
		/// LOCNO
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders LOCNO
		/// </remarks>
		public string LOCNO
		{
			get { return (this.m_LOCNO); }
			set { this.m_LOCNO = value; }
		}

		/// <summary>
		/// FSTATUS
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders FSTATUS
		/// </remarks>
		public string FSTATUS
		{
			get { return (this.m_FSTATUS); }
			set { this.m_FSTATUS = value; }
		}

		/// <summary>
		/// barcode
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders barcode
		/// </remarks>
		public string barcode
		{
			get { return (this.m_barcode); }
			set { this.m_barcode = value; }
		}

		/// <summary>
		/// d_accno
		/// </summary>
		/// <remarks>
		/// This property contains the ReportsDetailedFolders d_accno
		/// </remarks>
		public string d_accno
		{
			get { return (this.m_d_accno); }
			set { this.m_d_accno = value; }
		}
		#endregion
    
	#region Default Properties
	public List<DOReportsDetailedFolders> ReportsDetailedFolderss
	{
	  get { return m_ReportsDetailedFolderss; }
	  set { m_ReportsDetailedFolderss = value; }
	}    
	#endregion
	
    #endregion

    #region Class Methods
    public bool Retrieve()
    {
      sqlData = new SQLDataObject();
      DataSet resultDS = sqlData.ExecuteDataSetSQL(m_StoredProcedureConstRetrieve + " @" + RowFILENO + "=" + this.FILENO);
      return SetClassPropertiesFromDataSet(resultDS);
    }

    public bool RetrieveAll()
    {
      sqlData = new SQLDataObject();
      string sVariables = sqlData.GetVariables(this);

      DataSet resultDS = sqlData.ExecuteDataSetSQL(m_StoredProcedureConstRetrieveall + " " + sVariables);
      return SetClassPropertiesListFromDataSet(resultDS);
    }

    public bool Create()
    {
      bool success = false;
      sqlData = new SQLDataObject();
      string sVariables = sqlData.GetVariables(this);

      success = sqlData.ExecuteNonQuerySQL(m_StoredProcedureConstCreate + " " + sVariables);

      return success;
    }

    public bool Update()
    {
      bool success = false;
      sqlData = new SQLDataObject();

      string sVariables = sqlData.GetVariables(this);

      success = sqlData.ExecuteNonQuerySQL(m_StoredProcedureConstUpdate + " " + sVariables);

      return success;
    }

    private bool SetClassPropertiesFromDataSet(DataSet resultDS)
    {
      bool success = false;
      if (resultDS.Tables[0] != null)
      {
        if (resultDS.Tables[0].Rows.Count > 0)
        {
          foreach (DataRow dr in resultDS.Tables[0].Rows)
          {
					if (dr[RowFILENO].ToString() != "")
			this.FILENO = dr[RowFILENO].ToString();

		if (dr[Rowd_folder].ToString() != "")
			this.d_folder = dr[Rowd_folder].ToString();

		if (dr[Rowd_loc].ToString() != "")
			this.d_loc = dr[Rowd_loc].ToString();

		if (dr[Rowd_user].ToString() != "")
			this.d_user = dr[Rowd_user].ToString();

		if (dr[Rowdoctype].ToString() != "")
			this.doctype = dr[Rowdoctype].ToString();

		if (dr[Rowd_status].ToString() != "")
			this.d_status = dr[Rowd_status].ToString();

		if (dr[Rowd_datetime].ToString() != "")
			this.d_datetime = DateTime.Parse(dr[Rowd_datetime].ToString());

		if (dr[RowLOCNO].ToString() != "")
			this.LOCNO = dr[RowLOCNO].ToString();

		if (dr[RowFSTATUS].ToString() != "")
			this.FSTATUS = dr[RowFSTATUS].ToString();

		if (dr[Rowbarcode].ToString() != "")
			this.barcode = dr[Rowbarcode].ToString();

		if (dr[Rowd_accno].ToString() != "")
			this.d_accno = dr[Rowd_accno].ToString();
          }
          success = true;
        }
      }
      return success;
    }

    private bool SetClassPropertiesListFromDataSet(DataSet resultDS)
    {
      bool success = false;
      if (resultDS.Tables[0] != null)
      {
        if (resultDS.Tables[0].Rows.Count > 0)
        {
          foreach (DataRow dr in resultDS.Tables[0].Rows)
          {
            DOReportsDetailedFolders ReportsDetailedFolders = new DOReportsDetailedFolders();
			
					if (dr[RowFILENO].ToString() != "")
			ReportsDetailedFolders.FILENO = dr[RowFILENO].ToString();

		if (dr[Rowd_folder].ToString() != "")
			ReportsDetailedFolders.d_folder = dr[Rowd_folder].ToString();

		if (dr[Rowd_loc].ToString() != "")
			ReportsDetailedFolders.d_loc = dr[Rowd_loc].ToString();

		if (dr[Rowd_user].ToString() != "")
			ReportsDetailedFolders.d_user = dr[Rowd_user].ToString();

		if (dr[Rowdoctype].ToString() != "")
			ReportsDetailedFolders.doctype = dr[Rowdoctype].ToString();

		if (dr[Rowd_status].ToString() != "")
			ReportsDetailedFolders.d_status = dr[Rowd_status].ToString();

		if (dr[Rowd_datetime].ToString() != "")
			ReportsDetailedFolders.d_datetime = DateTime.Parse(dr[Rowd_datetime].ToString());

		if (dr[RowLOCNO].ToString() != "")
			ReportsDetailedFolders.LOCNO = dr[RowLOCNO].ToString();

		if (dr[RowFSTATUS].ToString() != "")
			ReportsDetailedFolders.FSTATUS = dr[RowFSTATUS].ToString();

		if (dr[Rowbarcode].ToString() != "")
			ReportsDetailedFolders.barcode = dr[Rowbarcode].ToString();

		if (dr[Rowd_accno].ToString() != "")
			ReportsDetailedFolders.d_accno = dr[Rowd_accno].ToString();

            this.ReportsDetailedFolderss.Add(ReportsDetailedFolders);
          }
          success = true;
        }
      }
      return success;
    }
    #endregion

    #region Class Support Methods
    #endregion
  }
}
